home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / bitstrg / clearbit.c < prev    next >
C/C++ Source or Header  |  1989-06-01  |  458b  |  30 lines

  1. /*
  2.     librairie : bitstrg
  3.  
  4.     clearbit --    mise a 0l d'un bit
  5.  
  6. */
  7.  
  8. #include "bitstrg.h"
  9.  
  10. /*
  11.     Clear specified bit
  12.  
  13.     if bit > map size, 0 is returned, else 1 is returned
  14. */
  15.  
  16. unsigned clearbit(ptr,bit)
  17.     struct SPARRAY * ptr;        /* pointer on structure */
  18.     unsigned    bit;            /* bit number */
  19. {
  20.  
  21.     if(ptr->numlbit < bit) {
  22.         return(0);
  23.     }
  24.  
  25.         /* AND original with 0 */
  26.  
  27.     (ptr->pntarray)[bit / SIZE] &= ~(1 << (bit & (SIZE - 1)));    
  28.     return(1);
  29. }
  30.